package com.example.gulimall.product.web;

import com.example.gulimall.product.service.SkuInfoService;
import com.example.gulimall.product.vo.SkuItemVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

/**
 * 商品详情 
 * @author GuLin
 * @date 2021-06-28 14:43
 */
@Controller
public class ItemController {

    @Autowired
    SkuInfoService skuInfoService;


    @GetMapping("/{skuId}.html")
    public String skuItem(@PathVariable("skuId") Long skuId, Model model)  {
        System.out.println("准备查询skuID===>:" + skuId + "详情");
        SkuItemVo vos = skuInfoService.queryItemBySkuId(skuId);
        model.addAttribute("item", vos);
        return "item";
    }

}
